package com.ce.pms.occupation.service.impl;


import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;

import org.springframework.util.Assert;

import com.ce.pms.base.service.impl.PmsBaseServiceImpl;
import com.ce.pms.charge.service.INonConventionalChargeService;
import com.ce.pms.charge.service.IParameterDefService;
import com.ce.pms.charge.vo.ChargeRecordVO;
import com.ce.pms.charge.vo.ParameterDefVO;
import com.ce.pms.common.model.SysrefcodeDO;
import com.ce.pms.common.util.BigDecimalUtil;
import com.ce.pms.exception.BusinessException;
import com.ce.pms.house.dao.IHouseDao;
import com.ce.pms.house.service.IHouseService;
import com.ce.pms.occupation.dao.IIdentityValidateDao;
import com.ce.pms.occupation.dao.IOccupationChargeDao;
import com.ce.pms.occupation.dao.IOccupationChargeItemDao;
import com.ce.pms.occupation.model.IdentityValidateDO;
import com.ce.pms.occupation.model.OccupationChargeDO;
import com.ce.pms.occupation.model.OccupationChargeItemDO;
import com.ce.pms.occupation.service.IIdentityValidateService;
import com.ce.pms.occupation.service.IOccupationChargeService;
import com.ce.pms.occupation.vo.IdentityValidateVO;
import com.ce.pms.occupation.vo.OccupationChargeItemVO;
import com.ce.pms.occupation.vo.OccupationChargeVO;
import com.ce.pms.system.occupation.dao.IOccupationChargeItemConfigDao;
import com.ce.pms.system.occupation.model.OccupationChargeItemConfigDO;
import com.ce.util.BeanUtil;
import com.ce.util.BlankUtil;


/**
 * 入伙预缴费服务实现类
 */
public class OccupationChargeServiceImpl extends PmsBaseServiceImpl implements IOccupationChargeService {

	private IHouseDao houseDao;
	private IHouseService houseService;
	private IIdentityValidateDao identityValidateDao;
	private IIdentityValidateService identityValidateService;
	private INonConventionalChargeService nonConventionalChargeService;
	private IOccupationChargeDao occupationChargeDao;
	private IOccupationChargeItemConfigDao occupationChargeItemConfigDao;
	private IOccupationChargeItemDao occupationChargeItemDao;
	private IParameterDefService parameterDefService;

	/**
	    * 功能描述:新增入伙缴费  <br>
	    * @param occupationChargeVO - 新增入伙缴费VO
	    * @return OccupationChargeVO
	    * @roseuid 494B68AA008C
	    *
	    * Create author:王浩羽 <br>
	    * Create on:2009-1-12  <br>
	    * Edit author:  <br>
	    * Edit on:    <br>
	    * Why:     <br>
	    */
	public OccupationChargeVO addOccupationCharge(OccupationChargeVO occupationChargeVO) {
		Assert.notNull(occupationChargeVO);
		Assert.notNull(occupationChargeVO.getCreator());
		Assert.notNull(occupationChargeVO.getIdentityValidate());
		Assert.notNull(occupationChargeVO.getIdentityValidate().getKeyword());
		Assert.notNull(occupationChargeVO.getIdentityValidate().getHouseId());
		Assert.notNull(occupationChargeVO.getIdentityValidate().getJoinMode());
		Long identityValidateId = occupationChargeVO.getIdentityValidate().getKeyword();
		//检查是否允许新增入伙缴费
		this.checkIsAllowAddOccupationCharge(identityValidateId);
		//查找入伙缴费DO
		OccupationChargeDO occupationChargeDO = this.occupationChargeDao.getOccupationChargeDOByIdentityId(identityValidateId);
		//查询所有在用的OccupationChargeItemConfigDO列表
		List<OccupationChargeItemConfigDO> noStopItemConfigs = occupationChargeItemConfigDao.queryAllCofigNotStop();
		List<OccupationChargeItemConfigDO> chargeItemConfigs = new ArrayList<OccupationChargeItemConfigDO>();
		if (BlankUtil.isBlank(occupationChargeDO)) {
			occupationChargeDO = new OccupationChargeDO();
			assembleOccupationChargeV2D(occupationChargeVO, occupationChargeDO);
			chargeItemConfigs.addAll(noStopItemConfigs);
		}else{
			//检查并过滤已转移过费用的CONFIG
			checkFiltrateUsedConfig(occupationChargeDO, noStopItemConfigs, chargeItemConfigs);
		}

		if(!BlankUtil.isBlank(chargeItemConfigs)) {
			// 获取房屋ID列表
			List<Long> houseIdList = this.gainHouseIdList(occupationChargeVO);
			BigDecimal sumMoneyToPay = BigDecimalUtil.getZEROInstance();
			Set<OccupationChargeItemDO> tempSet = new HashSet<OccupationChargeItemDO>();
			for(OccupationChargeItemConfigDO occupationChargeItemConfigDO : chargeItemConfigs) {

				for (Long tempHouseId : houseIdList) {
					OccupationChargeItemDO chargeItemDO = this.createOccupationChargeItem(tempHouseId,
																					   			occupationChargeItemConfigDO, occupationChargeDO);
					// 如果该费用是“跟进”状态,计算费用总数
					if(SysrefcodeDO.CONSTANTS_DIGITAL_ONE.equals(chargeItemDO.getTrackYn())) {
						sumMoneyToPay = sumMoneyToPay.add(chargeItemDO.getPayItemMoney());
					}
					tempSet.add(chargeItemDO);
				}
			}
			occupationChargeDO.getChargeItems().addAll(tempSet);
			if (BlankUtil.isBlank(occupationChargeDO.getKeyword())) {
				occupationChargeDO.setSysInfo(createInfo(occupationChargeVO.getCreator()));
				occupationChargeDO.setPrepaySum(sumMoneyToPay);
				occupationChargeDao.saveObject(occupationChargeDO);
			}else{
				super.modifyInfo(occupationChargeDO.getSysInfo(), occupationChargeVO.getCreator());
				occupationChargeDO.setPrepaySum(sumMoneyToPay.add(occupationChargeDO.getPrepaySum(), BigDecimalUtil.getMathContext()));
				occupationChargeDao.updateObject(occupationChargeDO);
				occupationChargeDao.flush();
			}

			Boolean isTrackYn = false;
			for(OccupationChargeItemDO occupationChargeItemDO : tempSet) {
				if (SysrefcodeDO.CONSTANTS_DIGITAL_ONE.equals(occupationChargeItemDO.getTrackYn())) {
					isTrackYn = true;
				}
				// 进行费用传递
				this.transferCharge(occupationChargeItemDO, occupationChargeVO.getCreator());
			}

			if (!isTrackYn) {
				identityValidateService.receiveAddedOccupationCharge(identityValidateId);
			}
		}
//		else{
//			throw new BusinessException("occupation:occupation_cannot_found_itemconfig_exception",
//																BusinessException.WARNING);
//		}
		occupationChargeVO.setKeyword(occupationChargeDO.getKeyword());
		return occupationChargeVO;
	}

	/** 功能描述: 检查是否允许新增入伙缴费 <br>
	 * @param identityValidateId 身份验证id
	 *
	 * Create author:付湘辉 <br>
	 * Create on:2009-1-13  <br>
	 * Edit author:  <br>
	 * Edit on:    <br>
	 * Why:     <br>
	*/
	public void checkIsAllowAddOccupationCharge(Long identityValidateId) {
		Assert.notNull(identityValidateId,"the identityValidateId must not be null.");
		if(!isAllowAddOccupationCharge(identityValidateId)) {
			throw new BusinessException("occupation:occupation_charge_add_exception", BusinessException.WARNING);
		}
	}

	// 留用
	public void delOccupationCharge(Long occupationChargeId)	{

	}

	//留用
	public OccupationChargeVO editOccupationCharge(OccupationChargeVO occupationCharge) {
		return null;
	}

	   /**
	    * 功能描述:获取费用总额  <br>
	    * @param identityValidateId TODO
	    * @param houseId
	    * @param joinMode
	    * @return
	    * Create author: 王浩羽 <br>
	    * Create on:Jan 13, 2009  <br>
	    * Edit author:  <br>
	    * Edit on:    <br>
	    * Why:     <br>
	    */
	public BigDecimal getTotalPaySum(Long identityValidateId, Long houseId, String joinMode) {
		BigDecimal sumMoneyToPay = BigDecimalUtil.getZEROInstance();
		
		// 查找入伙缴费DO
		OccupationChargeDO occupationChargeDO = this.occupationChargeDao.getOccupationChargeDOByIdentityId(identityValidateId);
		//查询所有在用的OccupationChargeItemConfigDO列表
		List<OccupationChargeItemConfigDO> noStopItemConfigs = occupationChargeItemConfigDao.queryAllCofigNotStop();
		List<OccupationChargeItemConfigDO> chargeItemConfigs = new ArrayList<OccupationChargeItemConfigDO>();
		if (BlankUtil.isBlank(occupationChargeDO)) {
			chargeItemConfigs.addAll(noStopItemConfigs);
		}else{
			//检查并过滤已转移过费用的CONFIG
			checkFiltrateUsedConfig(occupationChargeDO, noStopItemConfigs, chargeItemConfigs);
			sumMoneyToPay=sumMoneyToPay.add(occupationChargeDO.getPrepaySum(),BigDecimalUtil.getMathContext());
		}

		List<Long> houseIdList = new ArrayList<Long>();
		if (SysrefcodeDO.OCCUPATION_IN_MANAGEHOUSE.equals(joinMode)) {
			houseIdList = this.houseService.queryAllHouseIdListById(houseId);
		}else{
			houseIdList.add(houseId);
		}
		if(!BlankUtil.isBlank(chargeItemConfigs)) {
			for(OccupationChargeItemConfigDO occupationChargeItemConfigDO : chargeItemConfigs) {
				if(SysrefcodeDO.CONSTANTS_DIGITAL_ZERO.equals(occupationChargeItemConfigDO.getStopYn())) {
					continue;
				}

				for (Long tempHouseId : houseIdList) {
					BigDecimal payItemMoney = getPayItemMoney(tempHouseId, occupationChargeItemConfigDO);
					// 如果该费用是“跟进”状态,计算费用总数
					if(SysrefcodeDO.CONSTANTS_DIGITAL_ONE.equals(occupationChargeItemConfigDO.getPayTransferYn())) {
						sumMoneyToPay = sumMoneyToPay.add(payItemMoney);
					}
				}
			}
		}
		return sumMoneyToPay;
	}

	public void setHouseDao(IHouseDao houseDao) {
		this.houseDao = houseDao;
	}
	/**
	 * @param houseService the houseService to set
	 */
	public void setHouseService(IHouseService houseService) {
		this.houseService = houseService;
	}

	public void setIdentityValidateDao(IIdentityValidateDao identityValidateDao){
		this.identityValidateDao = identityValidateDao;
	}

	public void setIdentityValidateService(IIdentityValidateService identityValidateService) {
		this.identityValidateService = identityValidateService;
	}

	public void setNonConventionalChargeService(INonConventionalChargeService nonConventionalChargeService) {
		this.nonConventionalChargeService = nonConventionalChargeService;
	}


	public void setOccupationChargeDao(IOccupationChargeDao occupationChargeDao) {
		this.occupationChargeDao = occupationChargeDao;
	}

	public void setOccupationChargeItemConfigDao(IOccupationChargeItemConfigDao occupationChargeItemConfigDao) {
		this.occupationChargeItemConfigDao = occupationChargeItemConfigDao;
	}

	public void setOccupationChargeItemDao(IOccupationChargeItemDao occupationChargeItemDao)	{
		this.occupationChargeItemDao = occupationChargeItemDao;
	}


	public void setParameterDefService(IParameterDefService parameterDefService)	{
		this.parameterDefService = parameterDefService;
	}

	/**
	 * 功能描述: OccupationChargeItem集合 VO转DO <br>
	 * @param itemVOSet
	 * @param itemDOSet
	 * @return
	 * Create author: 王浩羽 <br>
	 * Create on:Jan 9, 2009  <br>
	 * Edit author:  <br>
	 * Edit on:    <br>
	 * Why:     <br>
	 */
	private Set<OccupationChargeItemDO> assembleOccupationChargeItemSetV2D(Set<OccupationChargeItemVO> itemVOSet, Set<OccupationChargeItemDO> itemDOSet) {
		if(itemVOSet==null)	{
			return new HashSet<OccupationChargeItemDO>();
		}

		for(OccupationChargeItemVO occupationChargeItemVO : itemVOSet) {
			OccupationChargeItemDO occupationChargeItemDO = new OccupationChargeItemDO();
			OccupationChargeItemDO itemDO = assembleOccupationChargeItemV2D(occupationChargeItemVO, occupationChargeItemDO);
			itemDOSet.add(itemDO);
		}

		return itemDOSet;
	}

	/**
	 * 功能描述: OccupationChargeItem VO转DO <br>
	 * @param occupationChargeItemVO
	 * @param occupationChargeItemDO
	 * @return
	 * Create author: 王浩羽 <br>
	 * Create on:Jan 9, 2009  <br>
	 * Edit author:  <br>
	 * Edit on:    <br>
	 * Why:     <br>
	 */
	private OccupationChargeItemDO assembleOccupationChargeItemV2D(OccupationChargeItemVO occupationChargeItemVO,
																	OccupationChargeItemDO occupationChargeItemDO) {
		BeanUtil.convertVoAsDo(occupationChargeItemVO, occupationChargeItemDO);
		return occupationChargeItemDO;
	}

	/**
	 * 功能描述: 费用VO 转换为 DO <br>
	 * @param chargeVO
	 * @param chargeDO
	 * @return
	 * Create author: 王浩羽 <br>
	 * Create on:Jan 9, 2009  <br>
	 * Edit author:  <br>
	 * Edit on:    <br>
	 * Why:     <br>
	 */
	private OccupationChargeDO assembleOccupationChargeV2D(OccupationChargeVO chargeVO, OccupationChargeDO chargeDO) {
		BeanUtil.convertVoAsDo(chargeVO, chargeDO);
		IdentityValidateVO identityValidateVO = chargeVO.getIdentityValidate();
		if (BlankUtil.isBlank(identityValidateVO.getKeyword())) {
			IdentityValidateDO identityValidateDO = new IdentityValidateDO();
			identityValidateService.assembleIdentityValidateV2D(identityValidateVO, identityValidateDO);
			chargeDO.setIdentityValidate(identityValidateDO);
		}else{
			chargeDO.setIdentityValidate(identityValidateDao.findById(identityValidateVO.getKeyword()));
		}

		Set<OccupationChargeItemVO> chargeItems = chargeVO.getChargeItems();
		Set<OccupationChargeItemDO> chargeItemDOs = assembleOccupationChargeItemSetV2D(chargeItems,chargeDO.getChargeItems());
		chargeDO.setChargeItems(chargeItemDOs);
		return chargeDO;
	}

	/** 功能描述:检查并过滤已传递过费用的CONFIG  <br>
	 * @param occupationChargeDO
	 * @param tempChargeItemConfigs
	 * @param chargeItemConfigs
	 *
	 * Create author:付湘辉 <br>
	 * Create on:2009-1-15  <br>
	 * Edit author:  <br>
	 * Edit on:    <br>
	 * Why:     <br>
	*/
	private void checkFiltrateUsedConfig(OccupationChargeDO occupationChargeDO, List<OccupationChargeItemConfigDO> tempChargeItemConfigs, List<OccupationChargeItemConfigDO> chargeItemConfigs) {
		Set<OccupationChargeItemDO>  set = occupationChargeDO.getChargeItems();

		outer:
		for (OccupationChargeItemConfigDO configDO : tempChargeItemConfigs) {
			for (Iterator<OccupationChargeItemDO> iter = set.iterator(); iter.hasNext();) {
				OccupationChargeItemDO itemDO = iter.next();
				if (configDO.getKeyword().equals(itemDO.getChargeItemConfigId())) {
					continue outer;
				}
			}
			chargeItemConfigs.add(configDO);
		}

//		if (BlankUtil.isBlank(chargeItemConfigs)) {
//			throw new BusinessException("occupation:occupation_charge_has_transfer_exception",
//																BusinessException.WARNING);
//		}
	}

	/**
	 * 功能描述:  新增入伙收费项目<br>
	 * @param houseId
	 * @param occupationChargeItemConfigDO
	 * @param occupationChargeDO TODO
	 * @return
	 * Create author: 王浩羽 <br>
	 * Create on:Jan 6, 2009  <br>
	 * Edit author:  <br>
	 * Edit on:    <br>
	 * Why:     <br>
	 */
	private OccupationChargeItemDO createOccupationChargeItem(Long houseId,
											OccupationChargeItemConfigDO occupationChargeItemConfigDO, OccupationChargeDO occupationChargeDO) {
		OccupationChargeItemDO chargeItemDO = new OccupationChargeItemDO();
		chargeItemDO.setChargeItemConfigId(occupationChargeItemConfigDO.getKeyword());
		chargeItemDO.setOccupationCharge(occupationChargeDO);
		chargeItemDO.setHouseId(houseId);
		BigDecimal payItemMoney = getPayItemMoney(houseId, occupationChargeItemConfigDO);
		chargeItemDO.setPayItemMoney(payItemMoney);
		chargeItemDO.setTrackYn(occupationChargeItemConfigDO.getPayTransferYn());
		chargeItemDO.setPayState(SysrefcodeDO.OM_FEE_STATE_NO);//设为未收
		chargeItemDO.setTransferYn(SysrefcodeDO.CONSTANTS_DIGITAL_ZERO);
		return chargeItemDO;
	}

	/** 功能描述:  <br>
	 * @param occupationChargeVO
	 * @return
	 *
	 * Create author:付湘辉 <br>
	 * Create on:2009-1-15  <br>
	 * Edit author:  <br>
	 * Edit on:    <br>
	 * Why:     <br>
	*/
	private List<Long> gainHouseIdList(OccupationChargeVO occupationChargeVO) {
		Long houseId = occupationChargeVO.getIdentityValidate().getHouseId();
		List<Long> houseIdList = new ArrayList<Long>();
		if (SysrefcodeDO.OCCUPATION_IN_MANAGEHOUSE.equals(occupationChargeVO.getIdentityValidate().getJoinMode())) {
			houseIdList = this.houseService.queryAllHouseIdListById(houseId);
		}else{
			houseIdList.add(houseId);
		}
		return houseIdList;
	}

	/**
	 * 功能描述: 获取单项费用 <br>
	 * @param houseId
	 * @param occupationChargeItemConfigDO
	 * @return
	 * Create author: 王浩羽 <br>
	 * Create on:Jan 5, 2009  <br>
	 * Edit author:  <br>
	 * Edit on:    <br>
	 * Why:     <br>
	 */
	private BigDecimal getPayItemMoney(Long houseId, OccupationChargeItemConfigDO occupationChargeItemConfigDO){
		BigDecimal payItemMoney = occupationChargeItemConfigDO.getPayMoney();
//		计费模式 001 按固定金额计费 002 按建筑面积计费
		  //如果是“按建筑面积计费” ，则乘以建筑面积
		if(SysrefcodeDO.RM_RENOVATE_CHARGE_MODE_SIZE.equals(occupationChargeItemConfigDO.getPayMode())) {
			BigDecimal squart = houseDao.findById(houseId).getBuildSize();
			payItemMoney = payItemMoney.multiply(squart.setScale(SysrefcodeDO.DATA_PRICE_SCALE),BigDecimalUtil.getMathContext());
		}
		Short months = occupationChargeItemConfigDO.getPayMonthCount();
		if(months==null || months == 0) {
			months = 1;
		}
		//乘以月份数
		return payItemMoney.multiply(new BigDecimal(months.intValue()),BigDecimalUtil.getMathContext()).setScale(SysrefcodeDO.DATA_PRICE_SCALE);
	}

	/**
	 * 功能描述: 是否允许收费 <br>
	 * 1、该房号的身份验证已通过（目前数据库中所有验证都是通过状态），并且还没进行钥匙移交，即：入伙操作未结束。<br>
	 * 2、该房号还没有进行预缴款处理。<br>
	 * @param identityValidateId
	 *        身份验证ID
	 * @return Create author: 王浩羽 <br>
	 *         Create on:Jan 5, 2009 <br>
	 *         Edit author: <br>
	 *         Edit on: <br>
	 *         Why: <br>
	 */
	private Boolean isAllowAddOccupationCharge(Long identityValidateId) {
		IdentityValidateDO identityValidateDO = identityValidateDao.findById(identityValidateId);
		if(identityValidateDO==null) {
			return false;
		}
		//验证未通过
		if(SysrefcodeDO.CONSTANTS_DIGITAL_ZERO.equals(identityValidateDO.getIdentityState())) {
			return false;
		}
		//物品移交钥匙移交) ： 已移交
		if(SysrefcodeDO.CONSTANTS_DIGITAL_ONE.equals(identityValidateDO.getHandoverState()))	{
			return false;
		}
		//预交费用状态 1 ： 已缴
		if(SysrefcodeDO.CONSTANTS_DIGITAL_ONE.equals(identityValidateDO.getChargeState()))	{
			return false;
		}
		return true;
	}

	/**
	 * 功能描述:  入伙预缴费用转移<br>
	 * @param chargeItemDO
	 * @param creator
	 * @return
	 * Create author: 王浩羽 <br>
	 * Create on:Jan 6, 2009  <br>
	 * Edit author:  <br>
	 * Edit on:    <br>
	 * Why:     <br>
	 */
	private ChargeRecordVO transferCharge(OccupationChargeItemDO chargeItemDO, Long creator){
		// 已移交
		if(SysrefcodeDO.CONSTANTS_DIGITAL_ONE.equals(chargeItemDO.getTransferYn())) {
			return null;
		}
		ChargeRecordVO chargeRecordVO = new ChargeRecordVO();
		chargeRecordVO.setHouseId(chargeItemDO.getHouseId());
		chargeRecordVO.setEnterAccountMethod(SysrefcodeDO.FEE_CHARGE_RECORD_ENTER_ACCOUNT_METHOD_DIRECT);//入账方式, 001-直接入账，002-合并入账
		chargeRecordVO.setSum(chargeItemDO.getPayItemMoney());//单项费用
		chargeRecordVO.setBizModule(SysrefcodeDO.FEE_CHARGE_RECORD_BIZ_MOUDLE_OCC);// 001-装修管理,002-客服事件，003-入伙管理
		chargeRecordVO.setBizType(SysrefcodeDO.FEE_CHARGE_RECORD_BIZ_TYPE_OCC_PRE);//业务类型：来自参数配置表的(006 入伙预交款)
		Long chargeItemID = chargeItemDO.getKeyword();
		OccupationChargeItemConfigDO itemConfigDO = occupationChargeItemConfigDao.findById(chargeItemDO.getChargeItemConfigId());
		chargeRecordVO.setBizId(chargeItemID);//业务ID：来自OccupationChargeItemDO

		chargeRecordVO.setBizCode(itemConfigDO.getBusinessCode().getBizCode());//交易码：来自OccupationChargeItemConfigDO
		chargeRecordVO.setItemName(itemConfigDO.getPayItemName());//费用项目名称：来自OccupationChargeItemConfigDO
		chargeRecordVO.setHandleYn(SysrefcodeDO.CONSTANTS_DIGITAL_ZERO);//是否已交易  1: 是		0: 否
		chargeRecordVO.setCreator(creator);
		chargeRecordVO.setRemark("入伙预缴费用");
//		HouseDomain houseDomain = houseDao.findById(chargeItemDO.getHouseId());
//		chargeRecordVO.setHouseNumber(houseDomain.getHouseNumber());
		//根据交易码ID判断操作类型，并写入
		ParameterDefVO parameterDefVO = parameterDefService.findParameterDefByPkey(SysrefcodeDO.OCCUPATION_CHARGE_CODE);
		if(BlankUtil.isBlank(parameterDefVO)
				|| BlankUtil.isBlank(parameterDefVO.getPvalue())) {
			throw new BusinessException("occupation:occupation_chargeRecordProcessor_businessCode_notFound_exception", BusinessException.WARNING);
		}
		Long businessCodeKeyword = parameterDefVO.getPvalue();//获得交易码ID
		if(businessCodeKeyword.equals(itemConfigDO.getBusinessCode().getKeyword())) {
			chargeRecordVO.setOperationType(SysrefcodeDO.FEE_CHARGE_RECORD_OPERATION_TYPE_PREPAY);//005 预交款收款
		}else{
			chargeRecordVO.setOperationType(SysrefcodeDO.FEE_CHARGE_RECORD_OPERATION_TYPE_PROPERTY);// 004 物业收费
		}
		//写入交易码ID
		chargeRecordVO.setBusinessId(itemConfigDO.getBusinessCode().getKeyword());
		nonConventionalChargeService.addChargeRecord(chargeRecordVO);
		chargeItemDO.setTransferYn(SysrefcodeDO.CONSTANTS_DIGITAL_ONE);//已转移
		occupationChargeItemDao.saveOrUpdateObject(chargeItemDO);
		return chargeRecordVO;
	}
}
